﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Carto;
using System.Windows.Forms;

namespace Tayninh2011
{
    sealed class TnRemoveLayerCmd:BaseCommand
    {

            private IMapControl3 m_mapControl;
            //private FrmCash frmCash = FrmCash.CallMe;

            public TnRemoveLayerCmd()
            {
                base.m_caption = "Remove Layer";
                //m_mapControl = (IMapControl3)map;
            }

            public override void OnClick()
            {
                ILayer layer = (ILayer)m_mapControl.CustomProperty;
                m_mapControl.Map.DeleteLayer(layer);
                MessageBox.Show(layer.Name);
                //frmCash.GetMapControl().Map.DeleteLayer(layer);
            }

            public override void OnCreate(object hook)
            {
                m_mapControl = (IMapControl3)hook;
            }
    }
}
